<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="../templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .ui-dialog .ui-terminal {
                border:0;
            }

            .ui-dialog .ui-dialog-content {
                padding:0;
            }
        </style>
    </ui:define>

    <ui:define name="content">
        <h1 class="title ui-widget-header ui-corner-all">Terminal - Dialog</h1>
        <div class="entry">
            <p>This example demonstrates dialog integration.</p>

            <h:form>
                <p:graphicImage value="/images/terminal.png" onclick="dlg.show();term.focus();" style="cursor:pointer"/>

                <p:dialog widgetVar="dlg" height="400" header="Terminal" resizable="false" modal="true">
                    <p:terminal widgetVar="term" commandHandler="#{terminalController.handleCommand}" width="590px"
                                welcomeMessage="Welcome to PrimeFaces Terminal, how are you today?"/>
                </p:dialog>
            </h:form>

            <h3>Source</h3>
            <p:tabView>
                <p:tab title="terminal.xhtml">
                    <pre name="code" class="xml">
&lt;h:form&gt;
    &lt;p:graphicImage value="/images/terminal.png" onclick="dlg.show();term.focus();" style="cursor:pointer"/&gt;

    &lt;p:dialog widgetVar="dlg" height="400" header="Terminal" resizable="false" modal="true"&gt;
        &lt;p:terminal widgetVar="term" commandHandler="\#{terminalController.handleCommand}" width="590px"
                    welcomeMessage="Welcome to PrimeFaces Terminal, how are you today?"/&gt;
    &lt;/p:dialog&gt;
&lt;/h:form&gt;
                    </pre>
                </p:tab>

                <p:tab title="TerminalController.java">
                    <pre name="code" class="java">
package org.primefaces.examples.view;

import java.util.Date;

public class TerminalController {

	public String handleCommand(String command, String[] params) {
		if(command.equals("greet"))
			return "Hello " + params[0];
		else if(command.equals("date"))
			return new Date().toString();
		else
			return command + " not found";
	}
}
                    </pre>
                </p:tab>
            </p:tabView>
        </div>


    </ui:define>
</ui:composition>